home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / groff108.lha / groff-1.08 / configure < prev    next >
Text File  |  1993-04-19  |  25KB  |  1,066 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      *) ;;
  74.     esac
  75.   fi
  76. done
  77.  
  78. trap 'rm -f conftest* core; exit 1' 1 3 15
  79.  
  80. rm -f conftest*
  81. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  82.  
  83. # A filename unique to this package, relative to the directory that
  84. # configure is in, which we can look for to find out if srcdir is correct.
  85. unique_file=groff/groff.cc
  86.  
  87. # Find the source files, if location was not specified.
  88. if test -z "$srcdir"; then
  89.   srcdirdefaulted=yes
  90.   # Try the directory containing this script, then `..'.
  91.   prog=$0
  92.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  93.   test "X$confdir" = "X$prog" && confdir=.
  94.   srcdir=$confdir
  95.   if test ! -r $srcdir/$unique_file; then
  96.     srcdir=..
  97.   fi
  98. fi
  99. if test ! -r $srcdir/$unique_file; then
  100.   if test x$srcdirdefaulted = xyes; then
  101.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  102.   else
  103.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  104.   fi
  105.   exit 1
  106. fi
  107. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  108. # But we can't avoid them for `..', to make subdirectories work.
  109. case $srcdir in
  110.   .|/*|~*) ;;
  111.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  112. esac
  113.  
  114. if test -z "$prefix"
  115. then
  116.   echo checking for grops to derive installation directory prefix
  117.   saveifs="$IFS"; IFS="$IFS:"
  118.   for dir in $PATH; do
  119.     test -z "$dir" && dir=.
  120.     if test $dir != . && test -f $dir/grops; then
  121.       # Not all systems have dirname.
  122.       prefix=`echo $dir|sed 's%/[^/][^/]*$%%'`
  123.       break
  124.     fi
  125.   done
  126.   IFS="$saveifs"
  127. fi
  128. if test -z "$prefix"
  129. then
  130.   echo checking for gcc to derive installation directory prefix
  131.   saveifs="$IFS"; IFS="$IFS:"
  132.   for dir in $PATH; do
  133.     test -z "$dir" && dir=.
  134.     if test $dir != . && test -f $dir/gcc; then
  135.       # Not all systems have dirname.
  136.       prefix=`echo $dir|sed 's%/[^/][^/]*$%%'`
  137.       break
  138.     fi
  139.   done
  140.   IFS="$saveifs"
  141. fi
  142.  
  143. if test -z "$CC"; then
  144.   echo checking for gcc
  145.   saveifs="$IFS"; IFS="${IFS}:"
  146.   for dir in $PATH; do
  147.     test -z "$dir" && dir=.
  148.     if test -f $dir/gcc; then
  149.       CC="gcc"
  150.       break
  151.     fi
  152.   done
  153.   IFS="$saveifs"
  154. fi
  155. test -z "$CC" && CC="cc"
  156.  
  157. # Find out if we are using GNU C, under whatever name.
  158. cat > conftest.c <<EOF
  159. #ifdef __GNUC__
  160.   yes
  161. #endif
  162. EOF
  163. ${CC-cc} -E conftest.c > conftest.out 2>&1
  164. if egrep yes conftest.out >/dev/null 2>&1; then
  165.   GCC=1 # For later tests.
  166. fi
  167. rm -f conftest*
  168.  
  169. cc_compile='$CCC conftest.cc -o conftest $CCLIBS $LIBS >/dev/null 2>&1'
  170.  
  171. if test -z "$CCC"; then
  172. # See whether the C compiler is also a C++ compiler.
  173. echo checking if C compiler is also a C++ compiler
  174. cat <<EOF > conftest.cc
  175. #ifdef __cplusplus
  176.   yes
  177. #endif
  178. EOF
  179. $CC -E conftest.cc >conftest.out 2>&1
  180. if egrep yes conftest.out >/dev/null 2>&1; then
  181.   CCC="$CC"
  182. fi
  183. fi
  184. if test -z "$CCC"; then
  185.   echo checking for g++
  186.   saveifs="$IFS"; IFS="${IFS}:"
  187.   for dir in $PATH; do
  188.     test -z "$dir" && dir=.
  189.     if test -f $dir/g++; then
  190.       CCC="g++"
  191.       break
  192.     fi
  193.   done
  194.   IFS="$saveifs"
  195. fi
  196. test -z "$CCC" && CCC=""
  197.  
  198. if test -z "$CCC"; then
  199.   echo checking for CC
  200.   saveifs="$IFS"; IFS="${IFS}:"
  201.   for dir in $PATH; do
  202.     test -z "$dir" && dir=.
  203.     if test -f $dir/CC; then
  204.       CCC="CC"
  205.       break
  206.     fi
  207.   done
  208.   IFS="$saveifs"
  209. fi
  210. test -z "$CCC" && CCC=""
  211.  
  212. if test -z "$CCC"; then
  213.   echo checking for cc++
  214.   saveifs="$IFS"; IFS="${IFS}:"
  215.   for dir in $PATH; do
  216.     test -z "$dir" && dir=.
  217.     if test -f $dir/cc++; then
  218.       CCC="cc++"
  219.       break
  220.     fi
  221.   done
  222.   IFS="$saveifs"
  223. fi
  224. test -z "$CCC" && CCC=""
  225.  
  226. if test -z "$CCC"; then
  227. cat <<EOM
  228. This package requires a C++ compiler, but I couldn't find one.
  229. Set the environment variable CCC to the name of your C++ compiler.
  230. EOM
  231. rm -f conftest* core; exit 1
  232. fi
  233. echo checking that C++ compiler can compile very simple C++ program
  234. cat <<EOF > conftest.cc
  235.  
  236. extern "C" { void exit(int); }
  237. int main() { exit(0); }
  238.  
  239. EOF
  240. rm -f conftest
  241. eval $cc_compile
  242. if test -s conftest && (./conftest) 2>/dev/null; then
  243.   :
  244. else
  245.   cat <<EOM
  246. $CCC was unable successfully to compile a very simple C++ program
  247. (the C++ program was in a file with a suffix of .cc)
  248. EOM
  249. rm -f conftest* core; exit 1
  250.  
  251. fi
  252. rm -f conftest*
  253. echo checking that C++ static constructors and destructors are called
  254. cat <<EOF > conftest.cc
  255.  
  256. extern "C" {
  257.   void exit(int);
  258.   void _exit(int);
  259. }
  260. int i;
  261. struct A {
  262.   char dummy;
  263.   A() { i = 1; }
  264.   ~A() { if (i == 1) _exit(0); }
  265. };
  266. A a;
  267. main() { exit(1); }
  268.  
  269. EOF
  270. rm -f conftest
  271. eval $cc_compile
  272. if test -s conftest && (./conftest) 2>/dev/null; then
  273.   :
  274. else
  275.   cat <<EOM
  276. $CCC is not installed correctly: static constructors and destructors do not work
  277. EOM
  278. rm -f conftest* core; exit 1
  279.  
  280. fi
  281. rm -f conftest*
  282. echo checking for C++ header files
  283. cat <<EOF >conftest.cc
  284. #include <stdio.h>
  285. extern "C" { void exit(int); }
  286. int main() { exit(0); } void t() { fopen(0, 0); }
  287. EOF
  288. if eval $cc_compile; then
  289.   :
  290. else
  291.   cat <<\EOF
  292. Your header files do not appear to support C++.
  293. I was unable to compile and link a simple C++ program that used a function
  294. declared in <stdio.h>.
  295. If you're using gcc/g++, you should install libg++.
  296. EOF
  297. rm -f conftest* core; exit 1
  298. fi
  299. rm -f conftest*
  300. if test -z "$PSPRINT"
  301. then
  302.     for p in lpr
  303. do
  304. if test -z "$LPR"; then
  305.   echo checking for $p
  306.   saveifs="$IFS"; IFS="${IFS}:"
  307.   for dir in $PATH; do
  308.     test -z "$dir" && dir=.
  309.     if test -f $dir/$p; then
  310.       LPR="$p"
  311.       break
  312.     fi
  313.   done
  314.   IFS="$saveifs"
  315. fi
  316. test -z "$LPR" && LPR=""
  317.  
  318. test -n "$LPR" && break
  319. done
  320.  
  321.     for p in lp
  322. do
  323. if test -z "$LP"; then
  324.   echo checking for $p
  325.   saveifs="$IFS"; IFS="${IFS}:"
  326.   for dir in $PATH; do
  327.     test -z "$dir" && dir=.
  328.     if test -f $dir/$p; then
  329.       LP="$p"
  330.       break
  331.     fi
  332.   done
  333.   IFS="$saveifs"
  334. fi
  335. test -z "$LP" && LP=""
  336.  
  337. test -n "$LP" && break
  338. done
  339.  
  340.     if test -n "$LPR" && test -n "$LP"
  341.     then
  342.         # HP-UX provides an lpr command that emulates lpr using lp,
  343.         # but it doesn't have lpq; in this case we want to use lp
  344.         # rather than lpr.
  345.         for p in lpq
  346. do
  347. if test -z "$LPQ"; then
  348.   echo checking for $p
  349.   saveifs="$IFS"; IFS="${IFS}:"
  350.   for dir in $PATH; do
  351.     test -z "$dir" && dir=.
  352.     if test -f $dir/$p; then
  353.       LPQ="$p"
  354.       break
  355.     fi
  356.   done
  357.   IFS="$saveifs"
  358. fi
  359. test -z "$LPQ" && LPQ=""
  360.  
  361. test -n "$LPQ" && break
  362. done
  363.  
  364.         test -n "$LPQ" || LPR=
  365.     fi
  366.     if test -n "$LPR"
  367.     then
  368.         PSPRINT="$LPR"
  369.     elif test -n "$LP"
  370.     then
  371.         PSPRINT="$LP"
  372.     fi
  373. fi
  374.  
  375. # Figure out DVIPRINT from PSPRINT.
  376. if test -n "$PSPRINT" && test -z "$DVIPRINT"
  377. then
  378.     if test "X$PSPRINT" = "Xlpr"
  379.     then
  380.         DVIPRINT="lpr -d"
  381.     else
  382.         DVIPRINT="$PSPRINT"
  383.     fi
  384. fi
  385.  
  386. echo checking for perl
  387. PERLPATH=
  388. saveifs="$IFS"; IFS="${IFS}:"
  389. for dir in $PATH; do
  390.   test -z "$dir" && dir=.
  391.   if test -f $dir/perl; then
  392.      PERLPATH="$dir/perl"
  393.      break
  394.   fi
  395. done
  396. IFS="$saveifs"
  397.  
  398. if test -z "$YACC"; then
  399.   echo checking for byacc
  400.   saveifs="$IFS"; IFS="${IFS}:"
  401.   for dir in $PATH; do
  402.     test -z "$dir" && dir=.
  403.     if test -f $dir/byacc; then
  404.       YACC="byacc"
  405.       break
  406.     fi
  407.   done
  408.   IFS="$saveifs"
  409. fi
  410. test -z "$YACC" && YACC=""
  411.  
  412. if test -z "$YACC"; then
  413.   echo checking for bison
  414.   saveifs="$IFS"; IFS="${IFS}:"
  415.   for dir in $PATH; do
  416.     test -z "$dir" && dir=.
  417.     if test -f $dir/bison; then
  418.       YACC="bison -y"
  419.       break
  420.     fi
  421.   done
  422.   IFS="$saveifs"
  423. fi
  424. test -z "$YACC" && YACC="yacc"
  425.  
  426.  
  427. if test -z "$RANLIB"; then
  428.   echo checking for ranlib
  429.   saveifs="$IFS"; IFS="${IFS}:"
  430.   for dir in $PATH; do
  431.     test -z "$dir" && dir=.
  432.     if test -f $dir/ranlib; then
  433.       RANLIB="ranlib"
  434.       break
  435.     fi
  436.   done
  437.   IFS="$saveifs"
  438. fi
  439. test -z "$RANLIB" && RANLIB="@:"
  440.  
  441. # Make sure to not get the incompatible SysV /etc/install and
  442. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  443. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  444. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  445. if test -z "$INSTALL"; then
  446.   echo checking for install
  447.   saveifs="$IFS"; IFS="${IFS}:"
  448.   for dir in $PATH; do
  449.     test -z "$dir" && dir=.
  450.     case $dir in
  451.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  452.     *)
  453.       if test -f $dir/install; then
  454.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  455.       : # AIX
  456.     else
  457.       INSTALL="$dir/install -c"
  458.       INSTALL_PROGRAM='$(INSTALL)'
  459.       INSTALL_DATA='$(INSTALL) -m 644'
  460.       break
  461.     fi
  462.       fi
  463.       ;;
  464.     esac
  465.   done
  466.   IFS="$saveifs"
  467. fi
  468. INSTALL=${INSTALL-cp}
  469. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  470. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  471.  
  472. echo checking for ln -s
  473. rm -f conftestdata
  474. if ln -s X conftestdata 2>/dev/null
  475. then
  476.   rm -f conftestdata
  477.   LN_S="ln -s"
  478. else
  479.   LN_S=ln
  480. fi
  481.  
  482.  
  483. echo checking for etags C++ option
  484. for flag in p C
  485. do
  486.     test -z "$ETAGSCCFLAG" || break
  487.     >conftest.c
  488.     (etags -$flag -o /dev/null conftest.c >/dev/null 2>&1) 2>/dev/null &&
  489.         ETAGSCCFLAG="-$flag"
  490.     rm -f conftest.c
  491. done
  492.  
  493. echo 'checking for csh # hack'
  494. cat <<EOF >conftest.sh
  495. #!/bin/sh
  496. true || exit 0
  497. export PATH || exit 0
  498. exit 1
  499. EOF
  500. chmod +x conftest.sh
  501. if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1
  502. then
  503.     :; SH_SCRIPT_SED_CMD='1s/.*/:/'
  504. else
  505.     :; SH_SCRIPT_SED_CMD=''
  506. fi
  507. rm -f conftest.sh
  508.  
  509.  
  510. echo checking for unistd.h
  511. echo checking how to run the C preprocessor
  512. if test -z "$CPP"; then
  513.   CPP='${CC-cc} -E'
  514.   cat > conftest.c <<EOF
  515. #include <stdio.h>
  516. EOF
  517. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  518. if test -z "$err"; then
  519.   :
  520. else
  521.   CPP=/lib/cpp
  522. fi
  523. rm -f conftest*
  524. fi
  525.  
  526. cat > conftest.c <<EOF
  527. #include <unistd.h>
  528. EOF
  529. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  530. if test -z "$err"; then
  531.   DEFS="$DEFS -DHAVE_UNISTD_H=1"
  532. fi
  533. rm -f conftest*
  534.  
  535. for hdr in dirent.h limits.h sys/dir.h stdlib.h
  536. do
  537. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  538. echo checking for ${hdr}
  539. cat > conftest.c <<EOF
  540. #include <${hdr}>
  541. EOF
  542. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  543. if test -z "$err"; then
  544.   DEFS="$DEFS -D${trhdr}=1"
  545. fi
  546. rm -f conftest*
  547. done
  548.  
  549. echo checking for 'C++ <limits.h>'
  550. cat <<EOF >conftest.cc
  551. #include <limits.h>
  552. extern "C" { void exit(int); }
  553. int main() { exit(0); } void t() { int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX; }
  554. EOF
  555. if eval $cc_compile; then
  556.   DEFS="$DEFS -DHAVE_CC_LIMITS_H=1"
  557. fi
  558. rm -f conftest*
  559. echo checking for 'C++ <unistd.h>'
  560. cat <<EOF >conftest.cc
  561. #include <unistd.h>
  562. extern "C" { void exit(int); }
  563. int main() { exit(0); } void t() { read(0, 0, 0); }
  564. EOF
  565. if eval $cc_compile; then
  566.   DEFS="$DEFS -DHAVE_CC_UNISTD_H=1"
  567. fi
  568. rm -f conftest*
  569. echo checking for declaration of getopt in stdlib.h
  570. cat <<EOF >conftest.cc
  571. #include <stdlib.h>
  572. extern "C" { void exit(int); }
  573. int main() { exit(0); } void t() { int opt = getopt(0, 0, 0); optarg = "foo"; optind = 1; }
  574. EOF
  575. if eval $cc_compile; then
  576.   DEFS="$DEFS -DSTDLIB_H_DECLARES_GETOPT=1"
  577. fi
  578. rm -f conftest*
  579. echo checking for declaration of getopt in unistd.h
  580. cat <<EOF >conftest.cc
  581. #include <sys/types.h>
  582. #include <unistd.h>
  583. extern "C" { void exit(int); }
  584. int main() { exit(0); } void t() { int opt = getopt(0, 0, 0); }
  585. EOF
  586. if eval $cc_compile; then
  587.   DEFS="$DEFS -DUNISTD_H_DECLARES_GETOPT=1"
  588. fi
  589. rm -f conftest*
  590.  
  591. echo checking for declaration of putenv
  592. cat <<EOF >conftest.cc
  593. #include <stdlib.h>
  594. extern "C" { void exit(int); }
  595. int main() { exit(0); } void t() { putenv((char *)0); }
  596. EOF
  597. if eval $cc_compile; then
  598.   DEFS="$DEFS -DSTDLIB_H_DECLARES_PUTENV=1"
  599. fi
  600. rm -f conftest*
  601. echo checking for time_t
  602. cat <<EOF >conftest.cc
  603. #include <time.h>
  604. extern "C" { void exit(int); }
  605. int main() { exit(0); } void t() { time_t t = time(0); struct tm *p = localtime(&t); }
  606. EOF
  607. if eval $cc_compile; then
  608.   :
  609. else
  610.   DEFS="$DEFS -DLONG_FOR_TIME_T=1"
  611. fi
  612. rm -f conftest*
  613. echo checking for return type of signal handlers
  614. cat > conftest.c <<EOF
  615. #include <sys/types.h>
  616. #include <signal.h>
  617. #ifdef signal
  618. #undef signal
  619. #endif
  620. extern void (*signal ()) ();
  621. main() { exit(0); } 
  622. t() { int i; }
  623. EOF
  624. if eval $compile; then
  625.   DEFS="$DEFS -DRETSIGTYPE=void"
  626. else
  627.   DEFS="$DEFS -DRETSIGTYPE=int"
  628. fi
  629. rm -f conftest*
  630.  
  631.  
  632. echo checking for struct exception
  633. cat > conftest.c <<EOF
  634. #include <math.h>
  635. main() { exit(0); } 
  636. t() { struct exception e; }
  637. EOF
  638. if eval $compile; then
  639.   DEFS="$DEFS -DHAVE_STRUCT_EXCEPTION=1"
  640. fi
  641. rm -f conftest*
  642.  
  643. echo checking for mmap
  644. cat > conftest.c <<EOF
  645. #include <sys/types.h>
  646. #include <sys/mman.h>
  647. main() { exit(0); } 
  648. t() { char *p = mmap(0, 0, PROT_READ, MAP_PRIVATE, 0, 0); munmap(p, 0); }
  649. EOF
  650. if eval $compile; then
  651.   DEFS="$DEFS -DHAVE_MMAP=1"
  652. fi
  653. rm -f conftest*
  654.  
  655. echo checking for pid_t in sys/types.h
  656. echo '#include <sys/types.h>' > conftest.c
  657. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  658. if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  659.   :
  660. else 
  661.   DEFS="$DEFS -Dpid_t=int"
  662. fi
  663. rm -f conftest*
  664.  
  665. echo checking for vfork.h
  666. cat > conftest.c <<EOF
  667. #include <vfork.h>
  668. EOF
  669. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  670. if test -z "$err"; then
  671.   DEFS="$DEFS -DHAVE_VFORK_H=1"
  672. fi
  673. rm -f conftest*
  674.  
  675. echo checking for working vfork
  676. cat > conftest.c <<EOF
  677. /* Thanks to Paul Eggert for this test.  */
  678. #include <stdio.h>
  679. #include <sys/types.h>
  680. #include <sys/stat.h>
  681. #ifdef HAVE_UNISTD_H
  682. #include <unistd.h>
  683. #endif
  684. #ifdef HAVE_VFORK_H
  685. #include <vfork.h>
  686. #endif
  687. main() {
  688.   pid_t parent = getpid();
  689.   pid_t child = vfork();
  690.  
  691.   if (child == 0) {
  692.     /* On sparc systems, changes by the child to local and incoming
  693.        argument registers are propagated back to the parent.
  694.        The compiler is told about this with #include <vfork.h>,
  695.        but some compilers (e.g. gcc -O) don't grok <vfork.h>.
  696.        Test for this by using lots of local variables, at least
  697.        as many local variables as main has allocated so far
  698.        including compiler temporaries.  4 locals are enough for
  699.        gcc 1.40.3 on a sparc, but we use 8 to be safe.
  700.        A buggy compiler should reuse the register of parent
  701.        for one of the local variables, since it will think that
  702.        parent can't possibly be used any more in this routine.
  703.        Assigning to the local variable will thus munge parent
  704.        in the parent process.  */
  705.     pid_t
  706.       p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
  707.       p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
  708.     /* Convince the compiler that p..p7 are live; otherwise, it might
  709.        use the same hardware register for all 8 local variables.  */
  710.     if (p != p1 || p != p2 || p != p3 || p != p4
  711.     || p != p5 || p != p6 || p != p7)
  712.       _exit(1);
  713.  
  714.     /* On some systems (e.g. IRIX 3.3),
  715.        vfork doesn't separate parent from child file descriptors.
  716.        If the child closes a descriptor before it execs or exits,
  717.        this munges the parent's descriptor as well.
  718.        Test for this by closing stdout in the child.  */
  719.     _exit(close(fileno(stdout)) != 0);
  720.   } else {
  721.     int status;
  722.     struct stat st;
  723.  
  724.     while (wait(&status) != child)
  725.       ;
  726.     exit(
  727.      /* Was there some problem with vforking?  */
  728.      child < 0
  729.  
  730.      /* Did the child fail?  (This shouldn't happen.)  */
  731.      || status
  732.  
  733.      /* Did the vfork/compiler bug occur?  */
  734.      || parent != getpid()
  735.  
  736.      /* Did the file descriptor bug occur?  */
  737.      || fstat(fileno(stdout), &st) != 0
  738.      );
  739.   }
  740. }
  741. EOF
  742. eval $compile
  743. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  744.   :
  745. else
  746.   DEFS="$DEFS -Dvfork=fork"
  747. fi
  748. rm -f conftest*
  749.  
  750. saved_libs="$LIBS"
  751. LIBS="$LIBS -lm"
  752. for func in fmod strtol getcwd strerror putenv
  753. do
  754. echo checking for ${func}
  755. cat > conftest.c <<EOF
  756.  
  757. main() { exit(0); } 
  758. t() { 
  759. /* Override any gcc2 internal prototype to avoid an error.  */
  760. extern char ${func}(); ${func}(); }
  761. EOF
  762. if eval $compile; then
  763.   :
  764. else
  765.   LIBOBJS="$LIBOBJS ${func}.o"
  766. fi
  767. rm -f conftest*
  768.  
  769. done
  770.  
  771. LIBS="$saved_libs"
  772. for func in rename mkstemp
  773. do
  774. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  775. echo checking for ${func}
  776. cat > conftest.c <<EOF
  777. #include <stdio.h>
  778. main() { exit(0); } 
  779. t() { 
  780. #ifdef __stub_${func}
  781. choke me
  782. #else
  783. /* Override any gcc2 internal prototype to avoid an error.  */
  784. extern char ${func}(); ${func}();
  785. #endif
  786.  }
  787. EOF
  788. if eval $compile; then
  789.   DEFS="$DEFS -D${trfunc}=1"
  790. fi
  791. rm -f conftest*
  792. #endif
  793. done
  794.  
  795. echo checking for sys_siglist
  796. cat > conftest.c <<EOF
  797.  
  798. main() { exit(0); } 
  799. t() { extern char *sys_siglist[]; sys_siglist[0] = 0; }
  800. EOF
  801. if eval $compile; then
  802.   DEFS="$DEFS -DHAVE_SYS_SIGLIST=1"
  803. fi
  804. rm -f conftest*
  805.  
  806. echo checking for gcc/g++ delete bug
  807. cat <<EOF > conftest.cc
  808.  
  809. #include <stdlib.h>
  810. #include <stddef.h>
  811.  
  812. int testit = 0;
  813.  
  814. int main()
  815. {
  816.   testit = 1;
  817.   int *p = new int;
  818.   delete p;
  819.   testit = 0;
  820.   exit(1);
  821. }
  822.  
  823. static unsigned dummy[3];
  824.  
  825. void *operator new(size_t n)
  826. {
  827.   if (testit) {
  828.     dummy[1] = -(unsigned)(dummy + 2);
  829.     return dummy + 2;
  830.   }
  831.   else
  832.     return (void *)malloc(n);
  833. }
  834.  
  835. void operator delete(void *p)
  836. {
  837.   if (testit) {
  838.     if (p == dummy)
  839.       exit(0);
  840.   }
  841.   else
  842.     free(p);
  843. }
  844.  
  845. EOF
  846. rm -f conftest
  847. eval $cc_compile
  848. if test -s conftest && (./conftest) 2>/dev/null; then
  849.   DEFS="$DEFS -DCOOKIE_BUG=1"
  850. fi
  851. rm -f conftest*
  852. echo checking for cfront ANSI C INT_MIN bug
  853. cat <<EOF > conftest.cc
  854. #include <stdlib.h>
  855. #ifdef HAVE_CC_LIMITS_H
  856. #include <limits.h>
  857. #else
  858. #define INT_MAX 2147483647
  859. #endif
  860.  
  861. #undef INT_MIN
  862. #define INT_MIN (-INT_MAX-1)
  863.  
  864. int main()
  865. {
  866.   int z = 0;
  867.   exit(INT_MIN < z);
  868. }
  869.  
  870. EOF
  871. rm -f conftest
  872. eval $cc_compile
  873. if test -s conftest && (./conftest) 2>/dev/null; then
  874.   DEFS="$DEFS -DCFRONT_ANSI_BUG=1"
  875. fi
  876. rm -f conftest*
  877. echo checking for new array delete syntax
  878. cat <<EOF >conftest.cc
  879.  
  880. extern "C" { void exit(int); }
  881. int main() { exit(0); } void t() { char *p = new char[5]; delete [] p; }
  882. EOF
  883. if eval $cc_compile; then
  884.   :
  885. else
  886.   DEFS="$DEFS -DARRAY_DELETE_NEEDS_SIZE=1"
  887. fi
  888. rm -f conftest*
  889. echo checking for traditional preprocessor
  890. cat <<EOF >conftest.cc
  891. #define name2(a,b) a/**/b
  892. extern "C" { void exit(int); }
  893. int main() { exit(0); } void t() { int name2(foo,bar); }
  894. EOF
  895. if eval $cc_compile; then
  896.   DEFS="$DEFS -DTRADITIONAL_CPP=1"
  897. fi
  898. rm -f conftest*
  899. echo checking for w_coredump
  900. cat > conftest.c <<EOF
  901.  
  902. #include <sys/types.h>
  903. #include <sys/wait.h>
  904. main()
  905. {
  906. #ifdef WCOREFLAG
  907.   exit(1);
  908. #else
  909.   int i = 0;
  910.   ((union wait *)&i)->w_coredump = 1;
  911.   exit(i != 0200);
  912. #endif
  913. }
  914.  
  915. EOF
  916. eval $compile
  917. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  918.   DEFS="$DEFS -DWCOREFLAG=0200"
  919. fi
  920. rm -f conftest*
  921. test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7
  922. echo using default value of ${BROKEN_SPOOLER_FLAGS} for grops -b option
  923.  
  924.  
  925. if test -z "$PAGE" && test -r $prefix/lib/groff/font/devps/DESC
  926. then
  927.     if grep "^paperlength 841890" \
  928.         $prefix/lib/groff/font/devps/DESC >/dev/null 2>&1
  929.     then
  930.         PAGE=A4
  931.     else
  932.         PAGE=letter
  933.     fi
  934. fi
  935. if test -z "$PAGE"
  936. then
  937.     dom=`awk '($1 == "dom" || $1 == "search") { print $2; exit}' \
  938.         /etc/resolv.conf 2>/dev/null`
  939.  
  940.     if test -z "$dom"
  941.     then
  942.         dom=`(domainname) 2>/dev/null | tr -d '+'`
  943.         if test -z "$dom"
  944.         then
  945.             dom=`(hostname) 2>/dev/null | grep '\.'`
  946.         fi
  947.     fi
  948.  
  949.     # If the top-level domain is two letters and it's not `us' or `ca'
  950.     # then they probably use A4 paper.
  951.     case "$dom" in
  952.     *.[Uu][Ss]|*.[Cc][Aa]) ;;
  953.     *.[A-Za-z][A-Za-z]) PAGE=A4 ;;
  954.     esac
  955. fi
  956. test -n "$PAGE" || PAGE=letter
  957. echo guessing $PAGE size paper
  958.  
  959. if test -n "$prefix"; then
  960.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  961.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  962. fi
  963. if test -n "$exec_prefix"; then
  964.   prsub="$prsub
  965. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  966. exec_prefix\\1=\\2$exec_prefix%"
  967. fi
  968.  
  969. trap 'rm -f config.status; exit 1' 1 3 15
  970. echo creating config.status
  971. rm -f config.status
  972. cat > config.status <<EOF
  973. #!/bin/sh
  974. # Generated automatically by configure.
  975. # Run this file to recreate the current configuration.
  976. # This directory was configured as follows,
  977. # on host `(hostname || uname -n) 2>/dev/null`:
  978. #
  979. # $0 $*
  980.  
  981. for arg
  982. do
  983.   case "\$arg" in
  984.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  985.     exec /bin/sh $0 $* ;;
  986.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  987.   esac
  988. done
  989.  
  990. trap 'rm -f Makefile; exit 1' 1 3 15
  991. CC='$CC'
  992. CCLIBS='$CCLIBS'
  993. CCC='$CCC'
  994. LPR='$LPR'
  995. LP='$LP'
  996. LPQ='$LPQ'
  997. PSPRINT='$PSPRINT'
  998. DVIPRINT='$DVIPRINT'
  999. PERLPATH='$PERLPATH'
  1000. YACC='$YACC'
  1001. RANLIB='$RANLIB'
  1002. INSTALL='$INSTALL'
  1003. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  1004. INSTALL_DATA='$INSTALL_DATA'
  1005. LN_S='$LN_S'
  1006. ETAGSCCFLAG='$ETAGSCCFLAG'
  1007. SH_SCRIPT_SED_CMD='$SH_SCRIPT_SED_CMD'
  1008. CPP='$CPP'
  1009. LIBOBJS='$LIBOBJS'
  1010. BROKEN_SPOOLER_FLAGS='$BROKEN_SPOOLER_FLAGS'
  1011. PAGE='$PAGE'
  1012. LIBS='$LIBS'
  1013. srcdir='$srcdir'
  1014. DEFS='$DEFS'
  1015. prefix='$prefix'
  1016. exec_prefix='$exec_prefix'
  1017. prsub='$prsub'
  1018. EOF
  1019. cat >> config.status <<\EOF
  1020.  
  1021. top_srcdir=$srcdir
  1022. for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  1023.   srcdir=$top_srcdir
  1024.   # Remove last slash and all that follows it.  Not all systems have dirname.
  1025.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  1026.   if test "$dir" != "$file"; then
  1027.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  1028.     test ! -d $dir && mkdir $dir
  1029.   fi
  1030.   echo creating $file
  1031.   rm -f $file
  1032.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  1033.   sed -e "
  1034. $prsub
  1035. s%@CC@%$CC%g
  1036. s%@CCLIBS@%$CCLIBS%g
  1037. s%@CCC@%$CCC%g
  1038. s%@LPR@%$LPR%g
  1039. s%@LP@%$LP%g
  1040. s%@LPQ@%$LPQ%g
  1041. s%@PSPRINT@%$PSPRINT%g
  1042. s%@DVIPRINT@%$DVIPRINT%g
  1043. s%@PERLPATH@%$PERLPATH%g
  1044. s%@YACC@%$YACC%g
  1045. s%@RANLIB@%$RANLIB%g
  1046. s%@INSTALL@%$INSTALL%g
  1047. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  1048. s%@INSTALL_DATA@%$INSTALL_DATA%g
  1049. s%@LN_S@%$LN_S%g
  1050. s%@ETAGSCCFLAG@%$ETAGSCCFLAG%g
  1051. s%@SH_SCRIPT_SED_CMD@%$SH_SCRIPT_SED_CMD%g
  1052. s%@CPP@%$CPP%g
  1053. s%@LIBOBJS@%$LIBOBJS%g
  1054. s%@BROKEN_SPOOLER_FLAGS@%$BROKEN_SPOOLER_FLAGS%g
  1055. s%@PAGE@%$PAGE%g
  1056. s%@LIBS@%$LIBS%g
  1057. s%@srcdir@%$srcdir%g
  1058. s%@DEFS@%$DEFS%
  1059. " $top_srcdir/${file}.in >> $file
  1060. fi; done
  1061.  
  1062. EOF
  1063. chmod +x config.status
  1064. test -n "$no_create" || ./config.status
  1065.  
  1066.